# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=asciidoc
pkgver=10.2.0
pkgrel=5
pkgdesc="Text based documentation"
url="https://asciidoc.org/"
arch="noarch"
license="GPL-2.0-or-later AND MIT"
depends="python3 libxml2-utils docbook-xsl"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest py3-pytest-mock"
subpackages="$pkgname-pyc $pkgname-doc"
source="https://github.com/asciidoc-py/asciidoc-py/releases/download/$pkgver/asciidoc-$pkgver.tar.gz"
options="!check" # py3-pytest-mock

replaces="$pkgname-vim"

build() {
	gpep517 build-wheel --wheel-dir .dist --output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" .dist/*.whl
	install -Dm644 doc/*.1 -t "$pkgdir"/usr/share/man/man1/
	install -Dm644 asciidoc/api.py -t "$pkgdir"/usr/lib/python3*/site-packages/asciidoc/
}

sha512sums="
e8f97559a169504bd2b47a5a4108268d08dbeb98e304486e64761c2603963f4610a0f96c443fdbb8ea289586f015d066681c8ad2946610864662d6df5d7ba9d6  asciidoc-10.2.0.tar.gz
"
